package com.xin.di.uav.applet.rest;

import com.xin.di.uav.applet.service.IOrderInfoService;
import com.xin.di.uav.common.request.order.OrderInfoAddRequest;
import com.xin.di.uav.po.OrderMapper;
import com.xin.di.uav.user.order.po.OrderPO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author LTQ
 * @since 2023-05-08
 */
@Controller
@RequestMapping("/sys/orderInfo")
public class OrderInfoRest {

    @Autowired
    private IOrderInfoService iOrderInfoService;

    @Autowired
    private OrderMapper orderInfoMapper;

    private final static Integer CONST_NUM = 4;
    private final static Integer TO_BE_PAID = -1;

    private final static Integer WAITING_FOR_ORDER_ACCEPTANCE = 0;

    private final static Integer MATERIAL_PREPARATION = 1;

    private final static Integer IN_TRANSIT = 2;



    public void add(OrderInfoAddRequest orderInfoAddRequest) {
        iOrderInfoService.add(orderInfoAddRequest);
    }



    public List<OrderPO> getOrders(@RequestParam Integer page, @RequestParam Integer size) {
        return iOrderInfoService.getOrders(page, size);
    }




    public Long getTotal(@RequestParam(required = false) String tcWaybillNo, @RequestParam(required = false) String tradeNo, @RequestParam(required = false) Integer type, @RequestParam(required = false) Integer platformCode, @RequestParam(required = false) String enterpriseId, @RequestParam(required = false) Integer payStatus, @RequestParam(required = false) Date startTransactionTime, @RequestParam(required = false) Date endTransactionTime) {
        return iOrderInfoService.getTotal(tcWaybillNo, tradeNo, type, platformCode, enterpriseId, payStatus, startTransactionTime, endTransactionTime);
    }






}